home *** CD-ROM | disk | FTP | other *** search
/ Mac Format 1996 April / MacFormat CD Edition MF36 (April 1996).iso / Shareware City / Developers / Tools Plus - GUI⁄Event libs / Tools Plus 2.6.1a Evaluat'n Kit / Tools Plus 2.6.1a / Tutorials / 2-Buttons on two windows / About… Buttons on two windows next >
INI File  |  1995-08-01  |  3KB  |  60 lines

  1. [Display in Geneva 12pt]
  2.  
  3.  
  4.  
  5.  
  6. Buttons on Two Windows
  7. ~~~~~~~~~~~~~~~~~~~
  8. Tools Plus lets you create and maintain buttons with ease because you reference all buttons with a button number that _you_ specify (as opposed to the Macintosh toolbox which uses handles). With this approach, it is simple to define constants for button numbers and to use those constants throughout your application, thus making your code more readable. There is little doubt what the following Tools Plus statement does:  DeleteButton(cancelButton).
  9.  
  10. This tutorial is a modification of the “Hello World” tutorial. In addition to the basics you saw in “Hello World,” you will:
  11.    • create a “tiled” (automatically positioned) window
  12.    • switch between two windows
  13.    • create and handle push buttons, radio buttons and
  14.       check boxes
  15.    • create button dependencies (i.e., if “A” is on, “B” is available)
  16.    • create buttons using a variety of fonts
  17.    • create a default push button (it has a dark band around it)
  18.       that automatically selects when you press the Enter or Return
  19.       key
  20.    • see how Tools Plus automatically disables buttons when their
  21.       parent window is inactive
  22.  
  23.  
  24.  
  25.  
  26. Additional Events
  27. ~~~~~~~~~~~~~~
  28. Your application will now respond to doChgWindow events. When the user clicks on an inactive window, Tools Plus generates a doChgWindow event thereby asking your application “is it okay to activate an inactive window?”  Your application may want to perform some validation and possibly disallow the activation of another window before the user corrects all mistakes on the currently active window.
  29.  
  30. When your application determines it’s okay to activate a window, you call the ActivateWindow routine and Tools Plus takes care of everything else.
  31.  
  32. Your application will also respond to doButton events. They are generated when the user clicks on a push button, check box or radio button. If the user moves the cursor off the (GUI) button before releasing the mouse button, this does not count as a button being clicked and Tools Plus does not generate an event.
  33.  
  34. A doButton event is also generated by a default push-button if the user presses the Enter or Return Key.
  35.  
  36.  
  37.  
  38.  
  39. Radio Button Groups
  40. ~~~~~~~~~~~~~~~~
  41. When creating a group of radio buttons that are logically related, your application draws the line around the button group as well as the label for the group.
  42.  
  43. Tools Plus does not know how your radio buttons are grouped, so when the user clicks a button in the group, your application must deselect all the buttons in the group and select the one that was clicked by the user. This can be done with only two lines of code regardless of the number of buttons you have in your group.
  44.  
  45.  
  46.  
  47.  
  48. Check Boxes
  49. ~~~~~~~~~~
  50. Check boxes are easily processed because they simply reverse their state when a user clicks on them (selected check boxes become deselected, and deselected check boxes become selected). With Tools Plus, this can be accomplished with a single line of very readable code.
  51.  
  52.  
  53.  
  54.  
  55. Fonts
  56. ~~~~
  57. Each button defaults to using the System Font (Chicago 12pt). By adding the useWFont constant to the button’s procID when creating a button, the button memorizes the window’s font, font size, and font style.
  58.  
  59. Unlike ordinary toolbox buttons, Tools Plus’s buttons are always remember their text settings even if you change their window’s text settings.
  60.